PowerShell 2.0 is positively bursting at the seams
with well over 200 cmdlets. However, the fact is that most of those
cmdlets are quite obscure and are unlikely to be of interest to most of
us. So, my goal in this section is to introduce you to a few cmdlets
that are useful
or interesting, so not only can you can use them to learn how PowerShell
works, but I hope you’ll also make use of these techniques to help you
control and tweak Windows 7.
Before getting to all that, it might help to get an overview of all the PowerShell cmdlets. To that end, Table 1
presents a complete list of the 236 cmdlets, organized by category. You
can view the Help text for any command by entering a command at the
PowerShell prompt using the following syntax:
get-help cmdlet [-detailed | -examples | -full]
Table 1. PowerShell’s Cmdlets, Organized by Category
Aliases | | |
Get-Alias | Import-Alias | Set-Alias |
Export-Alias | New-Alias | |
Content | | |
Add-Content | Get-Content | |
Clear-Content | Set-Content | |
Debugging | | |
Debug-Process | Get-TraceSource | Set-StrictMode |
Disable-PSBreakpoint | Remove-PSBreakpoint | Write-Debug |
Enable-PSBreakpoint | Set-PSBreakpoint | Write-Error |
Get-PSBreakpoint | Set-PSDebug | |
Drives | | |
Get-PSDrive | New-PSDrive | |
Get-PSProvider | Remove-PSDrive | |
Events | | |
Clear-EventLog | New-Event | Set-TraceSource |
Get-Event | New-EventLog | Show-EventLog |
Get-EventLog | Register-EngineEvent | Trace-Command |
Get-EventSubscriber | Register-ObjectEvent | Unregister-Event |
Get-WinEvent | Remove-Event | Wait-Event |
Limit-EventLog | Remove-EventLog | Write-EventLog |
Executing | | |
Get-Job | Measure-Command | Start-Job |
Invoke-Command | Receive-Job | Stop-Job |
Invoke-Expression | Remove-Job | Wait-Job |
Export/Import | | |
Export-Clixml | Export-Csv | Import-Counter |
Export-Counter | Import-Clixml | Import-Csv |
Formats | | |
ConvertFrom-Csv | ConvertTo-Html | Format-List |
ConvertFrom-SecureString | ConvertTo-SecureString | Format-Table |
ConvertFrom-StringData | ConvertTo-Xml | Format-Wide |
ConvertTo-Csv | Format-Custom | |
Items | | |
Clear-Item | Get-ItemProperty | Remove-ItemProperty |
Clear-ItemProperty | Invoke-Item | Rename-Item |
Copy-Item | Move-Item | Rename-ItemProperty |
Copy-ItemProperty | Move-ItemProperty | Set-Acl |
Get-Acl | New-Item | Set-Item |
Get-ChildItem | New-ItemProperty | Set-ItemProperty |
Get-Item | Remove-Item | |
Management | | |
Connect-WSMan | Get-WSManInstance | Set-WSManInstance |
Disable-WSManCredSSP | Invoke-WSManAction | Set-WSManQuickConfig |
Disconnect-WSMan | New-WSManInstance | Test-WSMan |
Enable-WSManCredSSP | New-WSManSessionOption | |
Get-WSManCredSSP | Remove-WSManInstance | |
Miscellaneous | | |
Get-Date | Read-Host | Send-MailMessage |
Import-LocalizedData | Select-String | Set-Date |
New-TimeSpan | Select-Xml | |
Operating System | | |
Add-Computer | New-Service | Start-Process |
Checkpoint-Computer | New-WebServiceProxy | Start-Service |
Disable-ComputerRestore | Remove-Computer | Start-Sleep |
Enable-ComputerRestore | Reset-ComputerMachinePassword | Stop-Computer |
Get-ComputerRestorePoint | Restart-Computer | Stop-Process |
Get-Counter | Restart-Service | Stop-Service |
Get-HotFix | Restore-Computer | Suspend-Service |
Get-Process | Resume-Service | Test-Connection |
Get-Service | Set-Service | Wait-Process |
Objects | | |
Add-Member | Group-Object | Tee-Object |
Compare-Object | Measure-Object | Update-List |
ForEach-Object | New-Object | Where-Object |
Get-Member | Select-Object | |
Get-Random | Sort-Object | |
Output | | |
Out-Default | Out-Null | Write-Output |
Out-File | Out-Printer | Write-Progress |
Out-GridView | Out-String | Write-Verbose |
Out-Host | Write-Host | Write-Warning |
Paths | | |
Convert-Path | Pop-Location | Set-Location |
Get-Location | Push-Location | Split-Path |
Join-Path | Resolve-Path | Test-Path |
PowerShell System | | |
Get-Command | Get-Help | Get-UICulture |
Get-Culture | Get-Host | |
PowerShell Session | | |
Add-History | Get-ExecutionPolicy | New-PSSession |
Add-PSSnapin | Get-FormatData | New-PSSessionOption |
Add-Type | Get-History | Register-PSSessionConfiguration |
Clear-History | Get-Module | Remove-Module |
Disable-PSSessionConfiguration | Get-PSCallStack | Remove-PSSession |
Enable-PSRemoting | Get-PSSession | Remove-PSSnapin |
Enable-PSRemoting | Get-PSSession | Remove-PSSnapin |
Enable-PSSessionConfiguration | Get-PSSessionConfiguration | Set-PSSessionConfiguration |
Enable-PSSessionConfiguration | Get-PSSessionConfiguration | Set-PSSessionConfiguration |
Enter-PSSession | Get-PSSnapin | Start-Transcript |
Exit-PSSession | Import-Module | Stop-Transcript |
Export-Console | Import-PSSession | Test-ModuleManifest |
Export-PSSession | New-ModuleManifest | |
Security | | |
Get-AuthenticodeSignature | Get-PfxCertificate | Set-ExecutionPolicy |
Get-Credential | Set-AuthenticodeSignature | Test-ComputerSecureChannel |
Transactions | | |
Complete-Transaction | Start-Transaction | Use-Transaction |
Get-Transaction | Undo-Transaction | |
Variables | | |
Clear-Variable | New-Variable | Set-Variable |
Get-Variable | Remove-Variable | Update-TypeData |
WMI | | |
Invoke-WmiMethod | Remove-WmiObject | |
Here, replace cmdlet with the name of the cmdlet you want to investigate. Add the -detailed switch to get extra-geeky data about the cmdlet, or add the -examples switch to see how you use the cmdlet in action; if you want both, add the -full switch, instead.
Tip
In Table 1, you’ll see lots of cmdlets that use the verb Get (such as Get-Alias and Get-Content). Get is PowerShell’s default verb, so you can save a bit of time and typing by leaving off the get- part when entering commands. For example, the following two commands are identical: